<template>
	<!-- #ifdef MP-WEIXIN -->
	<view class="searchStatusBar">
		<view class="statusBar" :style="{height:statusBarHeight + 'px'}"></view>
		<view class="content" :style="{height:contentHeight + 'px'}">
			<view class="left">
				<slot name="default">推荐</slot>
			</view>
			<view class="right">
				<view class="searchIcon" :style="{height:searchHeight + 'px',borderRadius: searchHeight/2 + 'px'}">
					<uni-icons class="icon" type="search" size="20"></uni-icons>
					搜索
				</view>
			</view>
		</view>
	</view>
	<view class="filler" :style="{height:fillterHeight + 'px'}">

	</view>
	<!-- #endif -->
	
	<!-- #ifdef H5 -->
	<view class="searchStatusBar">
		<view class="statusBar" :style="{height:statusBarHeight + 'rpx'}"></view>
		<view class="content" :style="{height:contentHeight + 'rpx'}">
			<view class="left">
				<slot>推荐</slot>
			</view>
			<view class="right">
				<view class="searchIcon" :style="{height:searchHeight + 'rpx',borderRadius: searchHeight/2 + 'px'}">
					<uni-icons class="icon" type="search" size="20"></uni-icons>
					搜索
				</view>
			</view>
		</view>
	</view>
	<view class="filler" :style="{height:fillterHeight + 'rpx'}">
	
	</view>
	<!-- #endif -->

</template>

<script setup>
	import {
		ref
	} from 'vue'
	//定义获取状态栏状况、和其高度属性
	const systemInfo = uni.getSystemInfoSync()
	const statusBarHeight = ref(systemInfo.statusBarHeight)

	// #ifdef MP-WEIXIN
	//定义获取微信小程序的menus属性（height，top）
	const menusInfo = uni.getMenuButtonBoundingClientRect()
	let {
		height,
		top
	} = menusInfo
	// console.log(statusBarHeight.value, height, top)
	//定义content高度
	const contentHeight = (top - statusBarHeight.value) * 2 + height
	//定义搜索栏高度
	const searchHeight = height
	//定义填充高度
	const fillterHeight = top + height + (top - statusBarHeight.value) + 10

	// #endif

	// #ifdef H5
	//定义content高度
	const contentHeight = 70
	//定义搜索栏高度
	const searchHeight = 55
	//定义填充高度
	const fillterHeight = 85
	// #endif
</script>

<style lang="scss" scoped>
	.searchStatusBar {
		// border: 1px solid black;
		position: fixed;
		left: 0;
		right: 0;
		z-index: 2;
		padding: 0 30rpx;
		background-image:
			linear-gradient(to bottom, transparent, #fff 380rpx),
			linear-gradient(to right, #bfedd6, #f5e3d9);

		.content {
			display: flex;

			.left {
				display: flex;
				align-items: center;
				font-size: 45rpx;
				font-weight: bold;
			}

			.right {
				margin-left: 27rpx;
				display: flex;
				height: 100%;
				align-items: center;

				.searchIcon {
					width: 220rpx;
					background-color: #e6f6ee;
					border: 1rpx solid white;
					border-radius: 30rpx;
					display: flex;
					align-items: center;
					font-size: 25rpx;
					color: #899991;

					.icon {
						margin-left: 28rpx;
						margin-right: 10rpx;
					}
				}

			}
		}
	}
</style>